package com.beimi.game;

import com.beimi.game.module.GameCardModule;
import com.beimi.game.module.GamePlayerModule;
import com.beimi.game.module.GameTurnModule;
import com.beimi.game.module.GameUserCmdModule;
import com.beimi.game.player.GamePlayer;
import com.next.core.container.IModuleContainer;
import com.next.core.container.ModuleContainer;

public class BaseGame implements IModuleContainer {
	private ModuleContainer moduleContainer;
	
	private int chuPai;
	
	public BaseGame() {
		moduleContainer = new ModuleContainer();	

		addModule(GameCardModule.class);
		addModule(GamePlayerModule.class);
		addModule(GameTurnModule.class);
		addModule(GameUserCmdModule.class);
	}
	
	public <T> T getModule(Class<T> clazz) {
		return moduleContainer.getModule(clazz);
	}

	public <T> boolean addModule(Class<T> clazz) {
		return moduleContainer.addModule(clazz);
	}

	public int getChuPai() {
		return chuPai;
	}

	public void setChuPai(int chuPai) {
		this.chuPai = chuPai;
	}

	public boolean checkTurn(GamePlayer player) {
		return getModule(GameTurnModule.class).getCurrentTurn() == player.getSeat();
	}

}
